class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        if(ransomNote.size() > magazine.size()) return false;

        // map<char, int> mp;
        int mp[26] = {0};  // 只有小写字母(数组更快捷)
        for(size_t i = 0; i < magazine.size(); ++i)
            mp[magazine[i] - 'a'] += 1;

        for(size_t i = 0; i < ransomNote.size(); ++i){
            if(mp[ransomNote[i] - 'a'] == 0) return false;
            mp[ransomNote[i] - 'a'] -= 1;
        }
        
        return true;
    }
};